import 'package:flutter/material.dart';

class TextIconButton extends StatelessWidget {
  final String text; // 左侧文字
  final VoidCallback onTap; // 点击事件回调
  final EdgeInsetsGeometry padding; // 内边距（可选）

  const TextIconButton({
    super.key,
    required this.text,
    required this.onTap,
    this.padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
  });

  @override
  Widget build(BuildContext context) {
    // InkWell组件点击带有效果比如水波纹
    // GestureDetector 点击事件检测组件
    return GestureDetector(
      onDoubleTap: onTap,
      child: Row(
        // mainAxisAlignment: MainAxisAlignment.spaceBetween, // 两端对齐
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          // 左侧文字
          Text(
            text,
            style: const TextStyle(
              fontSize: 18,
              fontWeight: FontWeight.bold,
              color: Colors.black,
            ),
          ),
          // 右侧图标
          const Icon(
            Icons.chevron_right,
            color: Colors.black,
            size: 16,
          ),
        ],
      ),
    );
  }
}
